// Some plug-in header
//
//////////////////////////////////////////////////////////////////////

#if !defined(MY_MAINFRAME_PLUG_IN)
#define MY_MAINFRAME_PLUG_IN

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#pragma warning(disable : 4786)
#include <map>
#include <afxcmn.h>
#include "DebugMenu.h"
// how the menu's are drawn, either original or XP style
typedef enum {BCMENU_DRAWMODE_ORIGINAL,BCMENU_DRAWMODE_XP} BC_MenuDrawMode;

// how seperators are handled when removing a menu (Tongzhe Cui)
typedef enum {BCMENU_NONE, BCMENU_HEAD, BCMENU_TAIL, BCMENU_BOTH} BC_Seperator;

class CODMenu  
{
public:

	CODMenu();
	CODMenu(bool special);
	virtual ~CODMenu();

// Attributes
public:
// Operations
public:
// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CODMenu)
	//}}AFX_VIRTUAL
	static void				EnumerateAndLoadToolbars();

// Implementation
public:

	 static void OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu);
	 static void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct);
	 static void OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct);

private:
	static BOOL GetBitmapFromImageList(CDC*  pDC,CImageList *imglist,int nIndex,CBitmap &bmp);
	static void		DitherBlt2(CDC *drawdc, CBitmap &bmp, COLORREF bgcolor);
	static void		DitherBlt3(CDC *drawdc, CBitmap &bmp, COLORREF bgcolor);
	static BOOL CALLBACK EnumResNameProc(HMODULE hModule, LPCTSTR lpszType, LPTSTR lpszName, LONG lParam);
	static void		GetDisabledBitmap(CBitmap &bmp, COLORREF background);
	static COLORREF	LightenColor(COLORREF col,double factor);
	
	static void			MeasureItem(LPMEASUREITEMSTRUCT lpMIS);
	static void			DrawItem(LPDRAWITEMSTRUCT lpDIS);
	static BOOL			IsLunaMenuStyle();
	static BOOL			IsNewShell();
	static BOOL			IsWinXPLuna();
	static BOOL			IsWindowsClassicTheme();
	static void			DrawItem_Win9xNT2000(LPDRAWITEMSTRUCT lpDIS);
	static void			DrawItem_WinXP(LPDRAWITEMSTRUCT lpDIS);
	static COLORREF		DarkenColor(COLORREF col,double factor);
	static BOOL			Draw3DCheckmark(CDC *dc, const CRect& rc, BOOL bSelected, HBITMAP hbmCheck);
	static BOOL			DrawXPCheckmark(CDC *dc, const CRect& rc, HBITMAP hbmCheck,COLORREF &colorout,BOOL selected);
	static void			DrawRadioDot(CDC *pDC,int x,int y,COLORREF color);
	static void			DrawCheckMark(CDC* pDC,int x,int y,COLORREF color,BOOL narrowflag=FALSE);

	static CFont	m_menuFont;
	static CFont	m_menuFontBold;
	static int		m_iconX;
	static int		m_iconY;
	static std::map<int, int>	m_commandToImage;
	// button images lists for normal/disabled states
	static CImageList	m_buttonImages;
	static CImageList	m_disabledImages;

	static HMENU			m_menuBeingProcessed;
	static bool			m_bSysMenu;				// true if prcoessing a system menu
	static int				m_minSystemMenuWidth;	// min width of a system menu for correct drawing

public:
	static HINSTANCE m_hInstance;
	static HINSTANCE* m_hInstanceList;
	static int nPulgInCounts;
#ifdef _DEBUG
	static int		m_pluggedInCount;
	friend class CDebugMenu;
#endif
};

#endif // !defined(MY_MAINFRAME_PLUG_IN)





















